import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.tree.ParseTreeWalker;
import org.junit.Test;

import java.io.IOException;
import java.net.URISyntaxException;

public class 测试 {
    
    @Test
    public void 测试解释器() throws IOException, URISyntaxException {
        var file = Tools.读文件(Tools.getResourcePath("t5.q"));
        var input = CharStreams.fromString(file);
        var lexer = new QLexer(input);// 词法分析器，将输入文本转换为词法符号
        var tokens = new CommonTokenStream(lexer);// 词法符号流
        var parser = new QParser(tokens);// 语法分析器
        ParseTreeWalker.DEFAULT.walk(new 监听器(), parser.program());
    }
}
